/*
 * Copyright 2008,2009,2010 Daniel Freitas
 * 
 * This file is part of DMF Generic DAO.
 * 
 * DMF Generic DAO is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 * 
 * DMF Generic DAO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with DMF Generic DAO. If not, see
 * <http://www.gnu.org/licenses/>.
 */
package com.googlecode.dmf.genericdao;

import java.io.Serializable;
import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * A "mixin" interface to add non generified versions of the methods from the {@link GenericDao} interface.
 * 
 * @author <a href="mailto:daniel.mfreitas@gmail.com">Daniel Freitas</a>
 */
public interface GenericlessGenericDao<T> extends GenericDao<T> {

    /**
     * Non-generic version of the {@link GenericDao#findById(Serializable)} method. This method requires an additional
     * {@link Class} parameter used to identify the type of the entity to load.
     * 
     * @param entityClass
     *            The {@link Class} of the entity to load.
     * 
     * @param id
     *            The object id to be queried for.
     * 
     * 
     * @return The object of the specified type whose id matches the given key, or null if the id cannot be found.
     * 
     * @see GenericDao#findById(Serializable)
     */
    @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
    public Object findById(Class<?> entityClass, Serializable id);

    /**
     * Non-generic version of the {@link GenericDao#findAll()} method. This method requires an additional {@link Class}
     * parameter used to identify the type of the entity to load.
     * 
     * @param entityClass
     *            The {@link Class} of the entity to load.
     * 
     * @return A {@link List} containing all objects from the given class stored in the persistence layer, in no
     *         particular order.
     */
    @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
    public List<Object> findAll(Class<?> entityClass);
}
